/**
 * 
 */
package org.xlab.baseframework.common.entity;

import java.io.Serializable;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.xlab.baseframework.service.spi.IUserService;

/**
 * @author makubex
 * 
 */
@Component
public abstract class AbstractSystemBean implements ApplicationContextAware,
		Serializable {

	/**
	 * @serialField
	 */
	private static final long serialVersionUID = -248069981716214282L;

	protected ApplicationContext applicationContext;
	protected IUserService userService;

	public void init() {
		if (this.userService == null)
			this.userService = this.applicationContext
					.getBean(IUserService.class);
	}

	/**
	 * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
	 */
	public void setApplicationContext(ApplicationContext arg0)
			throws BeansException {
		this.applicationContext = arg0;
	}

}
